import moduleRegist from '@/utils/moduleRegist';
import {
  module as taxpayerModule
} from './module';
import {
  module as taxpayerItemsModule
} from '../taxpayerItems/module';
const ListView = resolve => {
  require(['./ListView'], resolve);
};

const Layout = resolve => {
  require(['./Layout'], resolve);
};

const AddForm = resolve => {
  require(['./AddForm'], resolve);
};

const DetailForm = resolve => {
  require(['./DetailForm'], resolve);
};

export default [
  /** 配置管理路由 */
  {
    path: 'taxpayer',
    redirect: 'taxpayer/list',
    component: Layout,
    meta: {
      title: '商户',
      name: '商户',
      permission: '',
      componentName: 'TaxpayerLayout',
      keepAlive: true,
      icon: 'md-people',
      show: false
    },
    beforeEnter: (to, from, next) => {
      moduleRegist(taxpayerModule);
      moduleRegist(taxpayerItemsModule);
      next();
    },
    children: [{
      path: 'list',
      component: ListView,
      meta: {
        title: '商户列表',
        name: '商户',
        breadcrumb: '商户列表',
        permission: 'invoice:taxpayer:query',
        keepAlive: true,
        componentName: 'TaxpayerListView',
        icon: 'md-people'
      }
    },
    {
      path: 'add',
      component: AddForm,
      meta: {
        title: '添加商户',
        name: '添加商户',
        breadcrumb: '添加商户',
        permission: 'invoice:taxpayer:add',
        show: false,
        keepAlive: true,
        componentName: 'TaxpayerAddView',
        icon: 'md-people'
      }
    },
    {
      path: 'detail/:id',
      component: DetailForm,
      meta: {
        title: '商户详细',
        name: '商户详细',
        breadcrumb: '商户详细',
        permission: 'invoice:taxpayer:detail',
        show: false,
        keepAlive: true,
        componentName: 'TaxpayerDetailView',
        icon: 'md-people'
      }
    }]
  }
];
